﻿using BasicInformation.API.Application.Command.LineCommand;
using BasicInformation.Infrastructure.Interface;
using MediatR;

namespace BasicInformation.API.Application.CommandHandler.LineCommandHandler
{
    public class LineDeleteCommandHandler : IRequestHandler<LineDeleteCommand, int>
    {
        private readonly ILineRepository lineRepository;

        public LineDeleteCommandHandler(ILineRepository lineRepository)
        {
            this.lineRepository = lineRepository;
        }

        public async Task<int> Handle(LineDeleteCommand request, CancellationToken cancellationToken)
        {
            var info =await lineRepository.Get(request.Id);
            info.IsDel = true;
            return await lineRepository.Update(info);
        }
    }
}
